﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeBehind="QnATips.aspx.cs" Inherits="Nivdal.QnATips"
 Theme="SkinFile" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadPlaceHolder" runat="server">    
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
        <div class="basic_element">
        <div class="red_title">
           <asp:Label ID="PageTitleLabel" runat="server" Text="<%$ Resources:Resource, Tips_PageTitle %>" CssClass="white_title"></asp:Label>
        </div>
        <div class="padding5">

        
        <asp:Label ID="PreferredLanguageLabel" runat="server"
          Text="<%$ Resources:Resource, Register_PleaseChooseLanguage %>" SkinID="InfoLabel"> </asp:Label>
        <asp:DropDownList ID="LanguageDropDownList" runat="server" DataTextField="Language_Name" AutoPostBack="true"
            DataValueField="Language_Code" DataSourceID="LanguagesDataSource" OnSelectedIndexChanged="ChangeLanguage">
        </asp:DropDownList>
        <div style="height:20px;">
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                    <asp:Image ID="Progress" runat="server" ImageUrl="~/Images/ajax-loader.gif" />
            </ProgressTemplate>
        </asp:UpdateProgress>
        </div>
        <asp:ListView ID="TipsListView" runat="server" DataSourceID="TipsDataSource" DataKeyNames="TipId">
            <LayoutTemplate>
                <asp:Label ID="itemplaceholder" runat="server"></asp:Label>
            </LayoutTemplate>
            <ItemTemplate>
                <asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' SkinID="SmallHeaderLabel"></asp:Label>
                <br /><br />
                <asp:Label ID="TextLabel" runat="server" Text='<%# GetNivdalData.GetNivdalData.ReplaceLineBreaks(Eval("Text")) %>' SkinID="GridLabel"></asp:Label>
                <asp:Panel ID="EditPanel" runat="server" Visible='<%# IsUserAnEditor() %>'>
                    <asp:HiddenField ID="TipIdHiddenField" runat="server" Value='<%# Bind("TipId") %>' />
                    <br />
                    <asp:LinkButton ID="EditLinkButton" runat="server" Text="<%$ Resources:Resource, Global_Edit %>"
                     CommandName="Edit" SkinID="GreenTitleLink"></asp:LinkButton>
                    <asp:LinkButton ID="DeleteLinkButton" runat="server" Text="<%$ Resources:Resource, Global_Delete %>" 
                    CommandName="Delete" OnClientClick='<%# DeleteConformation() %>' SkinID="GreenTitleLink"></asp:LinkButton>
                </asp:Panel>
            </ItemTemplate>
            <EditItemTemplate>
                <asp:HiddenField ID="TipIdHiddenField" runat="server" Value='<%# Bind("TipId") %>' />
                <asp:Label ID="TitleLabel" runat="server" SkinID="InfoLabel" Text="<%$ Resources:Resource, Tips_TitleLabelText %>"></asp:Label><br />
                <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' TextMode="SingleLine" MaxLength="255" Width="300"></asp:TextBox>
                <br /><br />
                <asp:Label ID="TextTitleLabel" runat="server" SkinID="InfoLabel" Text="<%$ Resources:Resource, AdminAddNews_NewsContentLabel %>"></asp:Label>
                <br />
                <CustomControls:TextArea runat="server" ID="TextTextBox" MaxLength="4000" TextMode="MultiLine" 
                Height="100" Text='<%# Bind("Text") %>' Width="300"></CustomControls:TextArea>
                <br /><br />
                <asp:LinkButton ID="UpdateLinkButton" runat="server" SkinID="GreenTitleLink" CommandName="Update"
                 Text="<%$ Resources:Resource, Global_Update %>"></asp:LinkButton> 
                 <asp:LinkButton ID="CancelLinkButton" runat="server" SkinID="GreenTitleLink" CommandName="Cancel"
                 Text="<%$ Resources:Resource, Global_Cancel %>"></asp:LinkButton> 

            </EditItemTemplate>
            <ItemSeparatorTemplate><hr /></ItemSeparatorTemplate>
        </asp:ListView>
        </div>
        </div>
        
        <asp:Panel runat="server" ID="NewTipPanel">
            <div class="basic_element">
            <div class="red_title">
               <asp:Label ID="AddNewTipTitleLabel" runat="server" Text="<%$ Resources:Resource, Tips_AddNewTipText %>" CssClass="white_title"></asp:Label>
            </div>
            <div class="padding5">
                
            <asp:Label ID="NewTipLanguagesDataSource" runat="server"
                Text="<%$ Resources:Resource, Register_PleaseChooseLanguage %>" SkinID="InfoLabel"> </asp:Label>
                <asp:DropDownList ID="NewTipsLanguage" runat="server" DataTextField="Language_Name"
                    DataValueField="Language_Code" DataSourceID="AllLanguagesDataSource">
                
                </asp:DropDownList>
                <asp:RangeValidator ID="languageRequired" runat="server" ControlToValidate="NewTipsLanguage" MinimumValue="2" Text="*"
                 MaximumValue="999" SetFocusOnError="true" ValidationGroup="New" Type="Integer"></asp:RangeValidator>
                <br /><br />
                <asp:Label ID="TitleLabel" runat="server" SkinID="InfoLabel" Text="<%$ Resources:Resource, Tips_TitleLabelText %>"></asp:Label>
            
                <br />
                <asp:TextBox ID="NewTipTitle" runat="server" TextMode="SingleLine" MaxLength="255" Width="500"></asp:TextBox>
                <asp:RequiredFieldValidator ID="TitleRequired" runat="server" ErrorMessage="*" SetFocusOnError="true"
                 ControlToValidate="NewTipTitle" ValidationGroup="New"></asp:RequiredFieldValidator>
                <br /><br />
                <asp:Label ID="TextTitleLabel" runat="server" SkinID="InfoLabel" Text="<%$ Resources:Resource, AdminAddNews_NewsContentLabel %>"></asp:Label>
                 <br />
                <CustomControls:TextArea runat="server" ID="NewTipTextBox" MaxLength="4000" 
                TextMode="MultiLine" Height="100" Width="500"></CustomControls:TextArea>
                <asp:RequiredFieldValidator ID="TextRequired" runat="server" ErrorMessage="*" SetFocusOnError="true"
                 ControlToValidate="NewTipTextBox" ValidationGroup="New"></asp:RequiredFieldValidator>
                <br /><br />
                <asp:Button ID="CreateNewTipButton" runat="server" CssClass="GreenSmallButtonStyle" Text="<%$ Resources:Resource, Global_Submit %>"
                 OnClick="AddNewTip" CausesValidation="true" ValidationGroup="New" />
            </div>
            </div>
            
        </asp:Panel>
        <asp:SqlDataSource ID="LanguagesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetListOfTipsLanguages" SelectCommandType="StoredProcedure">
        
        </asp:SqlDataSource>
        <asp:SqlDataSource ID="AllLanguagesDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetListOfLanguages" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
        <asp:SqlDataSource ID="TipsDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
            SelectCommand="Nivdal_GetQnATips" SelectCommandType="StoredProcedure"
            UpdateCommand="Nivdal_EditQnATip" UpdateCommandType="StoredProcedure"
            DeleteCommand="Nivdal_DeleteQnATip" DeleteCommandType="StoredProcedure">
            <DeleteParameters>
                <asp:Parameter Name="TipId" Type="Decimal" />
            </DeleteParameters>

        </asp:SqlDataSource> 
        
    </ContentTemplate>
    </asp:UpdatePanel>
    
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageNamePlaceHolder" runat="server">
    <asp:Label ID="PageNameLabel" runat="server" Text="<%$ Resources:Resource, Tips_PageTitle %>" CssClass="PageNameContentStyle"></asp:Label>
</asp:Content>
